package com.lp.model.config;

public enum CodeMsg {

    //根基
    SUCCESS                           (10000, "操作成功"),
    FAIL                              (11000, "操作失败"),
    FAIL_EXCEPTION_SERVER             (11001, "服务器异常"),
    //用户异常
    FAIL_NULL_USER                    (11002, "用户信息不能为空"),
    FAIL_ERROR_USER                   (11003, "用户信息错误"),
    FAIL_EXISTS_USER                  (11004, "当前用户已存在，不可重复"),
    FAIL_NOT_EXISTS_USER              (11005, "当前用户不存在"),
    FAIL_NULL_FOLLOW                  (11006, "关注信息不能为空"),
    FAIL_NULL_UNFOLLOW                (11007, "取关信息不能为空"),
    FAIL_EXISTS_FOLLOW                (11008, "当前关注信息已存在，不可重复关注"),
    FAIL_EXPIRE_TOKEN                 (11009, "用户令牌过期，请重新登录"),
    FAIL_NULL_USERID                  (11010, "用户 id 不能为空"),
    FAIL_ERROR_USERID                 (11011, "非法用户 id"),
    FAIL_ERROR_USERNAME               (11012, "非法用户名！"),
    FAIL_NULL_USER_UPDATE(11013, "用户修改数据不能全部为空"),
    //文章异常
    FAIL_NULL_ARTICLE_PAGE            (12001, "文章分页数据不能为空"),
    FAIL_ERROR_ARTICLE_PAGE           (12002, "非法文章分页数据"),
    FAIL_NULL_ARTICLE                 (12003, "文章数据不能空"),
    FAIL_NULL_ARTICLE_ID              (12004, "文章 Id 不能为空"),
    FAIL_ERROR_ARTICLE_ID             (12005, "非法文章 id"),
    FAIL_NULL_LIKE                    (12006, "点赞数据不能为空"),
    FAIL_NULL_COLLECT                 (12007, "收藏数据不能为空"),
    FAIL_ERROR_ARTICLE                (12008, "非法文章信息"),
    FAIL_NOT_NULL_COMMENT             (12009, "文章评论信息不能为空"),
    FAIL_ERROR_COMMENT                (12010, "评论信息非法"),
    FAIL_NULL_PAGE                    (12011, "分页数据不能为空"),
    FAIL_ERROR_PAGE                   (12012, "分页数据非法"),
    //搜索异常
    FAIL_ERROR_SEARCH_PAGE            (1300, "搜索分页数据非法"),
    //远程调用异常
    FAIL_ERROR_RPC_ARTICLE                (1400, "远程调用获取到非法的文章数据"),
    FAIL_ERROR_RPC_USER                (1401, "远程调用获取到非法的用户数据"),
    //MQ 异常
    FAIL_NULL_MSG                      (1500, "mq 接受到空消息"),
    //redis 异常
    FAIL_EXCEPTION_REDIS              (20001, "redis 服务器异常"),
    FAIL_NULL_COMMENT             (12009, "文章评论信息不存在"),
    ;

    private Integer code;
    private String msg;

    CodeMsg(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    @Override
    public String toString() {
        return "code: " + code + ", msg: " + msg + ". ";
    }
}
